#include "OgreApplication.h"


MenuWindow::MenuWindow(){
	this->layoutName = "";
	this->shown = false;
}

MenuWindow::MenuWindow(Ogre::String name, bool instantlyopen){

	this->layoutName = name;
	this->shown		= false;
	
	this->load();

	if(instantlyopen)this->show();

}

MenuWindow::~MenuWindow(){
	this->cegui_window->destroy();
}

Ogre::String MenuWindow::getName(){
	return this->layoutName;
}

CEGUI::Window* MenuWindow::getWindow(){
	return this->cegui_window;
}

bool MenuWindow::isShown(){
	return this->shown;
}

void MenuWindow::load(){

		CEGUI::Window *guiRoot = CEGUI::WindowManager::getSingleton().getWindow("Blank"); 
		CEGUI::Window *gui = CEGUI::WindowManager::getSingleton().loadWindowLayout(this->layoutName);
        guiRoot->addChildWindow(gui);
		this->cegui_window = gui;
		this->hide();
		
}

void MenuWindow::show(){
	this->cegui_window->show();
	this->shown = true;
}

void MenuWindow::hide(){
	this->cegui_window->hide();
	this->shown = false;
}